<template>
  <div class="home" style="background-color: #f5f7fb">
    <div v-if="loading">
      <div style="height: 20px"></div>
      <van-skeleton title :row="5" loading></van-skeleton>
      <div style="height: 50px"></div>
      <van-skeleton title :row="5" loading></van-skeleton>
    </div>
    <div v-if="!loading && !failShow">
      <div class="box-item">
        <div class="box-item_title">基本信息</div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">客户名称</div>
          <div class="box-item_cell_text">{{ data.name }}</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">媒介类别</div>
          <div class="box-item_cell_text">{{ data.type_name }}</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">来源</div>
          <div class="box-item_cell_text">{{ data.source_name }}</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">返点比例</div>
          <div class="box-item_cell_text">{{ data.rebate_ratio }}%</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">客户电话</div>
          <div class="box-item_cell_text">{{ data.customer_phone }}</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">微信号</div>
          <div class="box-item_cell_text">{{ data.wechat }}</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">网址</div>
          <div class="box-item_cell_text">{{ data.url }}</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">客户备注</div>
          <div class="box-item_cell_text">{{ data.customer_remark }}</div>
        </div>
      </div>

      <div class="box-item">
        <div class="box-item_title">财务信息</div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">抬头类型</div>
          <div class="box-item_cell_text">{{ data.finance_type_name }}</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">开票地址</div>
          <div class="box-item_cell_text">{{ data.address }}</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">开票抬头</div>
          <div class="box-item_cell_text">{{ data.invoice_title }}</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">纳税号</div>
          <div class="box-item_cell_text">{{ data.tax_number }}</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">银行账户</div>
          <div class="box-item_cell_text">{{ data.bank_number }}</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">开户行</div>
          <div class="box-item_cell_text">{{ data.bank_address }}</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">身份证号</div>
          <div class="box-item_cell_text">{{ data.id_number }}</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">电话</div>
          <div class="box-item_cell_text">{{ data.finance_phone }}</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">财务信息备注</div>
          <div class="box-item_cell_text">{{ data.finance_remark }}</div>
        </div>
      </div>

      <div class="box-item">
        <div class="box-item_title">归属信息</div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">负责人</div>
          <div class="box-item_cell_text">{{ data.manage_name }}</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">归属部门</div>
          <div class="box-item_cell_text">{{ data.member_name }}</div>
        </div>
      </div>

      <div class="box-item">
        <div class="box-item_title">系统信息</div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">创建时间</div>
          <div class="box-item_cell_text">{{ data.create_time }}</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">创建人</div>
          <div class="box-item_cell_text">{{ data.create_name }}</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">最近修改人</div>
          <div class="box-item_cell_text">{{ data.update_name }}</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">成交状态</div>
          <div class="box-item_cell_text">{{ data.cj_name }}</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">总成交金额</div>
          <div class="box-item_cell_text">{{ data.cj_all_money | number_format }}元</div>
        </div>
        <div class="box-item_cell">
          <div class="box-item_cell_title">最近成交时间</div>
          <div class="box-item_cell_text">{{ data.cj_last_time }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
// @ is an alias to /src

import { Dialog, Toast, Notify } from "vant";

export default {
  name: "Home",
  components: {},
  data() {
    return {
      data: {
      },
      loading: true, /// 骨架屏是否显示
      failShow: false, ///是否请求失败
    };
  },
  computed: {
    review_id() {
      return this.$store.getters.getReview_id;
    },
    getUrlParam() {
      return this.$store.getters.getUrlParam;
    },
    getIsLogin() {
      return this.$store.getters.getIsLogin;
    },
    collection_info() {
      return JSON.parse(this.data.hk.collection_info);
    },
  },
  methods: {
    /**请求详情
     * id 详情id
     */
    getInfo(loading = true) {
      let vm = this;
      if (loading) {
        vm.loading = true;
      }
      this.$request
        .getCustomerDetail({
          review_id: vm.review_id,
          id: this.$route.query.id,
        })
        .then(
          (data) => {
            vm.data = data;
            vm.loading = false;
            vm.failShow = false;
          },
          function (error) {
            vm.failShow = true;
            vm.loading = false;
            Toast.fail("请求失败");
          }
        );
    },
    async getAdminInfoByCode() {
      let vm = this;
      vm.loading = true;
      await this.$store.dispatch("getAdminInfoByCode");
      if (!vm.getIsLogin) {
        Toast.fail("请求失败");
        /// 未登录
        return;
      }
      vm.getInfo(false);
      /// 登录了  继续做些操作
    },
  },
  mounted() {
    let vm = this;
    //刷新处理
    if (sessionStorage.getItem("urlParam")) {
      this.$store.commit(
        "mutationsUrlParam",
        JSON.parse(sessionStorage.getItem("urlParam"))
      );
    }
    if (vm.getIsLogin) {
      //列表进入
      vm.getInfo();
    } else {
      vm.getAdminInfoByCode();
    }
  },
};
</script>

<style scoped>
.home {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background-color: #f8f8f8;
  padding-bottom: constant(safe-area-inset-bottom); /*兼容 IOS<11.2*/
  padding-bottom: env(safe-area-inset-bottom); /*兼容 IOS>11.2*/
}
.box-item {
  background-color: #fff;
  padding: 12px 0;
  padding-bottom: 2px;
  margin-bottom: 10px;
}
.box-item_title {
  padding-left: 9px;
  font-size: 14px;
  padding-bottom: 8px;
  color: #110b32;
  position: relative;
  margin-bottom: 10px;
}
.box-item_title::before {
  content: " ";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background-color: #f0f1f6;
  bottom: 0;
}
.box-item_cell {
  display: flex;
  padding: 0px 9px;
  margin-bottom: 11px;
  padding-right: 22px;
  /* align-items: center; */
}

.box-item_cell_title {
  font-size: 14px;
  /* font-weight: bold; */
  color: #8a929a;
  font-size: 14px;
  text-align: left;
  width: 100px;
}
.box-item_cell_text {
  font-size: 14px;
  color: #110b32;
  flex: 1;
  align-items: center;
  display: flex;
  overflow: hidden;
  word-wrap: break-word;
  white-space: normal;
  word-break: break-all;
}

.cost-cell {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
}
.cost-cell_top {
  display: flex;
  margin-left: 8px;
  align-items: center;
}
.cost-cell_top_img {
  width: 15px;
  height: 15px;
}
.cost-cell_top_text {
  margin-left: 4px;
  font-size: 14px;
  color: #110b32;
}
.cost-cell_item {
  margin-top: 7px;
  margin-left: 9px;
  margin-right: 9px;
  /* margin-bottom: 4px; */
  background: #f9f9fd;
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  padding: 7px;
}
.cost-cell_item_cell {
  display: flex;
  font-size: 14px;
  color: #8a929a;
  margin: 3px 0;
  padding: 0 10px;
}
.cost-cell_item_cell div {
  text-align: center;
}

.cost-cell_item_cell_flex {
  flex: 1;
  text-align: left !important;
  display: flex;
}
.numerical {
  color: #110b32;
  margin-top: 5px;
  overflow: hidden;
  word-wrap: break-word;
  white-space: normal;
  word-break: break-all;
}
.note span {
  overflow: hidden;
  word-wrap: break-word;
  white-space: normal;
  word-break: break-all;
}
.felx {
  flex: 1;
  overflow: hidden;
  margin: 0 5px;
}
.cost-cell_item_cell span {
  color: #110b32;
  margin-left: 5px;
}
.cost-cell_top_text span {
  color: #5b97ff;
  display: inline-block;
  margin-left: 6px;
}
.cost-cell_item_cell_bottom {
  color: #110b32;
}
.combined-box {
  height: 38px;
  display: flex;
  align-items: center;
  padding-left: 11.5px;
  padding-right: 22px;
  position: relative;
}
.combined-box::before {
  content: " ";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background-color: #f0f1f6;
  top: 0;
}
.combined-box div {
  /* flex: 1; */
  font-size: 14px;
  color: #110b32;
}
.note {
  font-size: 14px;
  margin-left: 11.5px;
  margin-right: 22px;
  margin-bottom: 8px;
  display: flex;
}
.note span {
  display: inline-block;
  margin-left: 5px;
  color: #8a929a;
  flex: 1;
}
.process-box {
  padding-bottom: 26px;
  padding-left: 54px;
  position: relative;
  padding-right: 20px;
}
.process-box_title {
  font-size: 14px;
  line-height: 20px;
  color: #110b32;
  display: flex;
  align-items: center;
}
.process-box_text {
  font-size: 14px;
  color: #8a929a;
  line-height: 20px;
  margin-top: 4px;
  word-wrap: break-word;
}
.ok-tag {
  width: 48px;
  height: 19px;
  background: #f5fff6;
  border-radius: 4px;
  border: 1px solid #5ec367;
  font-size: 12px;
  color: #5ec367;
  text-align: center;
  display: inline-block;
  margin-left: 7px;
}
.err-tag {
  border-color: #ea6969;
  background-color: #fff8f7;
  color: #ea6969;
}
.process-box_tag {
  width: 24px;
  height: 24px;
  background: #f1f6ff;
  border: 1px solid #5792ff;
  position: absolute;
  color: #5792ff;
  font-size: 14px;
  border-radius: 50%;
  text-align: center;
  line-height: 24px;
  left: 14px;
  top: -2px;
}
.boder {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 27px;
  width: 0px;
  border-left: 1px dashed #dce2eb;
}
.process-box_tag_atv {
  background-color: #5792ff;
  color: #fff;
}
.process-box_tag_gray {
  background-color: #f9f9f9;
  color: #d1d1d1;
  border-color: #f9f9f9;
}
.process-box_not .process-box_title {
  color: #8a929a;
}
.process-box_not .process-box_text {
  color: #cacaca;
}
.err-text {
  color: #ea6969;
  font-size: 12px;
  margin-top: 2px;
}
.bottom-box {
  position: fixed;
  height: 190px;
  /* padding-top: 10px; */
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #fff;
}
textarea {
  background: none;
  outline: none;
  border: none;
  background: #f8f8fb;
  border-radius: 3px;
  height: 52px;
  width: 100%;
  padding: 7px;
  box-sizing: border-box;
  font-size: 13px;
  resize: none;
}
.btn {
  width: 128px;
  height: 36px;
  background: #4c90fb;
  border-radius: 4px;
  font-weight: 600;
  color: #ffffff;
  line-height: 36px;
  letter-spacing: 1px;
  font-size: 16px;
  text-align: center;
}
.btn-box {
  display: flex;
  margin-top: 10px;
  margin-left: 50px;
  margin-right: 50px;
}
.btn-blck {
  border: 1px solid #2880fb;
  height: 34px;
  width: 126px;
  background-color: #fff;
  color: #2880fb;
}
.mask {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.39);
}
.mask-box {
  width: 289px;
  height: 176px;
  background: #ffffff;
  border-radius: 8px;
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  margin: auto;
}
.mask-box_title {
  font-size: 16px;
  text-align: center;
  font-weight: 500;
  color: #1b1e2b;
  margin-top: 13px;
  margin-bottom: 20px;
}
.mask-box_sel_title {
  font-size: 13px;
  color: #1b1e2b;
}
.mask-box_sel {
  display: flex;
  align-items: center;
  margin: 0 18px;
}
.mask-box_sel_box {
  height: 33px;
  background: #f8f8fb;
  border-radius: 4px;
  border: 1px solid #e3e7f4;
  font-size: 13px;
  color: #a6abc0;
  flex: 1;
  line-height: 33px;
  padding-left: 9px;
  box-sizing: border-box;
  margin-left: 3px;
}
.mask-box_sel_btn {
  font-size: 16px;
  display: flex;
  margin: 0 18px;
  margin-top: 40px;
}
.mask-box_sel_btn div {
  flex: 1;
  text-align: center;
  font-weight: 500;
  color: #2459fd;
}
.info-tag {
  background-color: #f4fbff;
  border-color: #5b97ff;
  color: #5b97ff;
}
.box-item_cell_link {
  color: #1455d4;
}
.btn-blck_disable {
  background-color: #ddd;
  border-color: #ddd;
  color: #fff;
}
.cost-cell_item_cell_title {
  width: 80px;
  text-align: left !important;
  float: left;
}
.cost-cell_item_cell_text {
  float: left;
  flex: 1;
  overflow: hidden;
  text-align: left !important;
  overflow: hidden;
  word-wrap: break-word;
  white-space: normal;
  word-break: break-all;
  color: #110b32;
  margin-right: 5px;
}
.combined-box_text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.felx-box {
  /* width: 30%; */
  /* flex: 1; */
  overflow: hidden;
  width: 86px;
}
.felx-box_right {
  text-align: right !important;
}
.felx-box_left {
  text-align: left !important;
}
.process-box_remark {
  display: flex;
}
.remark-text {
  overflow: hidden;
  word-wrap: break-word;
  white-space: normal;
  word-break: break-all;
  flex: 1;
}

/* 商单表格样式 */
.business_order .border {
  width: 100%;
  border: solid rgb(232, 232, 232);
  border-width: 1px 0px 0px 1px;
}
.business_order .order_item {
  border: solid rgb(232, 232, 232);
  border-width: 0px 1px 1px 0px;
  font-size: 14px;
}
.business_order .order_item .row {
  display: flex;
}
.business_order .order_item .row:first-child div {
  padding: 4px 10px 2px;
}
.business_order .order_item .row:last-child div {
  padding: 2px 10px 4px;
}
.business_order .order_item .row .title {
  min-width: 60px;
  text-align: center;
  border: solid rgb(232, 232, 232);
  border-width: 0px 1px 0px 0px;
  color: #8a929a;
}
.business_order .order_item .row .counten {
  color: #110b32;
}
</style>
